package com.cy.dao;


import com.cy.pojo.Admi;
import com.cy.pojo.Show;
import com.cy.pojo.UserBean;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
@Mapper
public interface StuMapper {
    /*-------------------------------------------------------------------------------------------------*/
    @Select("select * from show")
    ArrayList<Show> selectShowAll();

    @Select("select  top ${size} * from show where show.names not in ( select top ${begin} names from show )")
    ArrayList<Show> selectShowPage(@Param("begin") int begin, @Param("size") int size);

    @Select("select count(*) from show")
    int selectTotalCount(int count);

    @Select("select * from show where names like '%${names}%'")
    ArrayList<Show>selectShowNames(String names);

    @Select("select  * from show where type = #{type}")
    ArrayList<Show>selectShowType(String type);

    @Select("select count(*) from show where names like '%${names}%'")
    int selectselectCount(String names);

    @Select("select count(*) from show where type = #{type}")
    int selectselectCount1(String type);

    @Select("select * from zhuce")
    ArrayList<Admi> selectZhuce();

    @Select("select * from show where sellers=#{seller};")
    void deleteShowNames(@Param("name")String name,@Param("seller")String seller);

    @Insert("insert into xingxi (name, password) values(#{name},#{password});")
    void insertxingxi(@Param("name") String name,@Param("password")String password);

    @Delete("delete from zhuce where name=#{name} and password=#{password};")
    void deleteZhuce(@Param("name")String name,@Param("password")String password);

    @Select("select * from show where sellers=#{seller};")
    ArrayList<Show> selectSellerNames(String seller);

    @Insert("insert into show(names, prices,sellers,numbers,type) values(#{names},#{prices},#{sellers},#{numbers},#{type});")
    void insertshow(@Param("names")String names,@Param("prices")int prices,@Param("sellers")String sellers,@Param("numbers")int numbers,@Param("type")String type);

    @Select("select * from xingxi where name=#{name} and password=#{password};")
    UserBean selectXingxi(@Param("name")String name, @Param("password")String password);

    @Insert("insert into zhuce (name, password,password1) values(#{name},#{password},#{password1});")
    void insertZhuce(@Param("name") String name,@Param("password") String password, @Param("password1") String password1);
}
